<?php

/**
 * Created by PhpStorm.
 * User: DMF
 * Date: 2017/5/25
 * Time: 0:18
 */

namespace Home\Widget;
use Think\Controller;

class PubWidget extends Controller{
    private $_cartonCur,$_movieCur,$_tvCur;
    public function __construct()
    {
        parent::__construct();
        $this->_model = new \Home\Model\ListModel();
    }

    public function head(){

        $this->display('Pub:head');
    }

    public function right(){
        $type = I('type')==null?0:I('type');
        //选择tab标签
        $tab = array('','','','');
        if($type==0){
            $tab[0] = 'active';
        }else if($type==1){
            $tab[1] = 'active';
        }else if($type==2){
            $tab[2] = 'active';
        }else if($type==3){
            $tab[3] = 'active';
        }else if($type==4){
            $tab[4] = 'active';
        }else if($type==5){
            $tab[5] = 'active';
        }else if($type==6){
            $tab[6] = 'active';
        }
        $this->assign('m_tab',$tab);
        $this->display('Pub:right');
    }

    public function foot(){
        $type = I('type')==null?0:I('type');
        if($type==1){
            $ajax_type = 'ajax_carton';
        }else if($type==2){
            $ajax_type = 'ajax_movie';
        }else if($type==3){
            $ajax_type = 'ajax_tv';
        }
        $this->assign('ajax_type',$ajax_type);
        $this->display('Pub:foot');
    }
    //全部tab
    public function all_tab(){
        $cate[0] = $this->_model->carton();
        $cate[1] = $this->_model->movice();
        $cate[2] = $this->_model->tv();
        $this->assign('cate',$cate);
        $this->display('Pub:all_tab');
    }
    //动画tab
    public function carton_tab(){
        $cate = $this->_model->carton();
        $this->assign('cate',$cate);
        $this->assign('cnt',count($this->_model->cate()[0]));
        $this->display('Pub:carton_tab');
    }
    //电影tab
    public function movie_tab(){
        $cate = $this->_model->movice();
        $this->assign('cate',$cate);
        $this->assign('cnt',count($this->_model->cate()[1]));
        $this->display('Pub:movie_tab');
    }
    //电视剧tab
    public function tv_tab(){
        $cate = $this->_model->tv();
        $this->assign('cate',$cate);
        $this->assign('cnt',count($this->_model->cate()[2]));
        $this->display('Pub:tv_tab');
    }
}